 
  <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html lang="en-US">
  
  <head>
  	<title>color</title>
  	<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />	

    
	<script src="js/jquery/jquery.js" type="text/javascript"></script>
	<script src="js/jquery/ifx.js" type="text/javascript"></script>
	<script src="js/jquery/idrop.js" type="text/javascript"></script>
	<script src="js/jquery/idrag.js" type="text/javascript"></script>
	<script src="js/jquery/iutil.js" type="text/javascript"></script>
	<script src="js/jquery/islider.js" type="text/javascript"></script>
	
	<script src="/js/jquery.js" type="text/javascript"></script>
 <!-- <script type="text/javascript" src="js/bootstrap-dropdown.js"></script> -->
    
	<script src="js/jquery/color_picker/color_picker.js" type="text/javascript"></script>


	<link href="js/jquery/color_picker/color_picker.css" rel="stylesheet" type="text/css">
	<style type="text/css">
		.body{
			background-color:#F3F1EC;
		}
		div .container{
			padding-top:4px;
			
		}
		.row{
			margin-top:60px;
		}
		.wall{
			border:1px solid #DDD;
			background-color:white;
			border-top:0px;
			padding:30px;
			font-size:17px;
		}
		
	</style>
</head>

  </head>
  
  <body style="background-color:white">
 	<div class="navbar navbar-fixed-top"  style="background-color:black">
	  <div class="navbar-inner" style="background-color:black;width:768px;margin-left:50px;" >
		<div class="container"   style="background-color:black">
			<a class="brand" href="#">
			  <img src="img/user_group.png" alt="" />&nbsp;客户关系管理系统
			</a>
			<ul class="nav">
			  <li class="active">
				<a href="welcome.action">概览</a>
			  </li>
			  <li><a href="contacts.action">通讯录</a></li>
			  <li><a href="tasks.action">任务</a></li>
			  <li><a href="chances.action">机会</a></li>
			  <li><a href="fanhui.action">讨论</a></li>
			  <li class="dropdown" id="menutest1">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest1">
				  添加
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				  <li><a href="new_contact.action"><i class="icon-user"></i>&nbsp;联系人</a></li>
				  <li><a href="new_company.action"><i class="icon-home"></i>&nbsp;公司</a></li>
				  <li class="divider"></li>
				  <li><a href="new_task.action"><i class="icon-ok"></i>&nbsp;任务</a></li>
				  <li><a href="new_chance.action"><i class="icon-star-empty"></i>&nbsp;机会</a></li>
				</ul>
			  </li>
			  
			</ul>
			
			<ul class="nav pull-right" >
			  <li>
				<a href="#">${sessionScope.user.username }</a>
			  </li>
			  <li class="dropdown" id="menutest2">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest2">
				  管理
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				  <li><a href="manage_user.action?id=${sessionScope.user.id }"><i class="icon-user"></i>&nbsp;同事</a></li>
				  <li><a href="manage_group.action"><i class="icon-list-alt"></i>&nbsp;组</a></li>
				  <li class="divider"></li>
				  <li><a href="manage_account.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li>
				</ul>
			  </li>
			  <li class="divider-vertical"></li>
			  <li><a href="sign_in.action">退出</a></li>
			</ul>
			
		</div>
	  </div>
	</div>
	
	
	<div class="container" style="background-color:#F1EAEA;margin-top:100px;" >
	<div class="row" >			
		<div class="span12"  style="margin-right:-20px;  ">
			
				<div class="wall " style="height:40px;margin-top:-70px;padding-top:20px;background-color:#F1EAEA; ">
				   <span style="font-size:20px;font-weight:bold">添加类型</span>
				   <hr style="margin-top:3px;margin-bottom:3px">
				   <form action="addType.action" method="post">
				   <span>请输入:</span>
			
				   <input name="type" value="" type="text"  style="margin-top:5px;height:22px" id="Type" />
				   	 
				   	    <input  type="submit"  id="save">
				   	      </form>
				</div>	
		
			<div class="wall " style="height:400px;margin-top:0px;padding-top:15px; background-color:#F1EAEA;">	
				<span style="font-size: 25px">编辑</span>
			
				<form class="form-horizontal" action = "" method = "post" >
					 <fieldset>
					 <div class="control-group">
						<table class="table ">
						<tbody id="addim">
						
									<c:forEach items="${liTypes}" var="ty">
							<tr>
							<td >
								   &nbsp;<g id="${ty.color}" style="display:inline"> ${ty.type}: </g><input name="" type="text" class="${ty.id}" value="${ty.type}" style="display:none;padding-left:0px;"/><span class="${ty.createtimes}"></span> <div style="float:left;width:65px;display:none">
										 <input type="text" id="${ty.uuids}" value="red" style="width:60px;" />
										</div> 
										
										<div style="float:left ;" >
										<input name="check" type="checkbox" style="float:left" id="${ty.dealuuid}" />
											<a href="javascript:void(0);" rel="colorpicker&amp;objcode=${ty.uuids}&amp;objshow=${ty.id }&amp;showrgb=1&amp;" style="text-decoration:none;" attached="true" f="${ty.id}" res="${ty.uuids}" v="${ty.createtimes}" l="${ty.createtimes}" color="${ty.color }" dealuuid="${ty.dealuuid}" >
											<div id="${ty.id}" style="width: 100px; height: 15px;margin-left:15px; border: 1px solid black; background-color: #${ty.color} ">
											   
											</div>
										
											</a>
												
						         
									  </div>  <!-- <input type="button" style="padding-left:30px;" id="edite" value="编辑"> -->
									  <span type="button"  class="btn btn-primary fg" id="${ty.createtimes}" style="display:none">确定</span>
									  <f type="button"  class="btn btn-primary fg ${ty.uuids}"  style="display:none">取消</f>
								
									
									  
								
							</td>
																				
							</tr>
							</c:forEach>
								
								
						</tbody>
					</table>
					</div>
					
					<div class="control-group">
						<div style="margin:10px 0px 0px 0px; ">
							<a type="submit" class="btn btn-primary" href="addtask.action"> 保存</a>
							<a class="btn btn-info" id="" href="addtask.action">返回</a>
						</div>
					</div>
				</fieldset>
				</form>
			</div>
		</div>
	</div>
</div>


<script language="Javascript">

	

	//init colorpicker:
	$(document).ready(

		function()
		{
			$.ColorPicker.init(); 
		      var jk;
		      var i;
		      var ll;
		      var success;
		      var qx;
		      var colors;
		       var background;
		       var backgroun;
		       var typeid;
			 $("a").click (function(){
			    var f= $(this).attr("res");
			    var b=$(this).attr("f");
			    var l=$(this).attr("v");
			    var suc=$(this).attr("l");
			    var colo=$(this).attr("color");
			 /*  var dealuui=$(this).attr("dealuuid");
			   alert(dealuui); */
			      typeid=b;
			    backgroun=colo;
			     background="#"+b;
			//  点击确定后获得成功后的span class
			    success="."+suc;
			    //获得color
			    jk="#"+f;
			    //获得隐藏input的 value（type) class
			    i="."+b;
			    //点击确定后 id
			    ll="#"+l;
			    //点击取消 class
			    qx="."+f;
			    colors="#"+colo;
			//var  lj=$(jk).val();
			    // alert(lj);
			   $(i).css("display","inline");
			   $(ll).css("display","inline");
			   $(success).css("display","none");
			   $(qx).css("display","inline");
			 $(colors).css("display","none");
			}) ;
			 
			  	var h;
			$("a").mouseover(function(){
			 var  dealuuid=$(this).attr("dealuuid");
			   var b=$(this).attr("f");
			   typeid=b;
			   h="#"+dealuuid;
			
			}) ;
			
			
		   $(h).click(function(){
		    var check= $(h).attr("checked");
		 
		   // alert(check);
		   if(check==true){
			    if(confirm("是否删除")){
			  
			     $.post("dealTaskType.action",{typeid:typeid},function(json){
			    })
			    $(h).ajaxComplete(function(){
		    
		         deltelim(this);
		    
		 });
			    
			    }else{
			   $(h).attr("checked",false);
			    }
			    }
			  
			});
			
			  $("span").click(function(){
			    //获得改变后颜色的属性
			    var t=$(jk).val();
			   //input 修改后type的名字 
			    var name=$(i).val();
			     $(i).css("display","none");
			     $(ll).css("display","none");
			     $(success).css("display","inline");
			     $(qx).css("display","none");
			     
			     $(success).text("成功");
			      $(colors).css("display","inline");
			      $(colors).text(name);
			    //  alert(name);
			     // alert(t);
			 
			 $.post("updatType.action",{type:name,typeColor:t,typeid:typeid},function(json){
			    
			 }) ;
			 }) ;
				
				
			   $("f").click(function(){
			     //alert(backgroun);
			      $(background).css("background-color","#"+backgroun);
			       $(i).css("display","none");
			       $(ll).css("display","none");
			       $(qx).css("display","none");
			     $(colors).css("display","inline");
			  }) ;
		/*  $("#save").click(function(){
		   var name=$("#Type").value;
		   $.post("saveTaskType.action",{type:name},function(json){
		         
		   
		   
		   })
		 
		 }) */
			   
			   
			  
		}
		);
		 function deltelim(obj) {
			var div =  obj.parentNode.parentNode.parentNode;
			document.getElementById("addim").removeChild(div);
  }
</script>
</body>
</html>